package com.mobiftpcms.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;

import com.mobiftpcms.model.BaseObject;

@Entity
@Table(name = "user_task_param")
@Searchable
public class UserTaskParam extends BaseObject implements Serializable {
	private Long id;
	
	private String paramName;
	
	private String paramValue;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
    @SearchableId
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	
	@Column(name = "param_name", nullable = false, length = 100)
    @SearchableProperty
	public String getParamName() {
		return paramName;
	}

	public void setParamName(String paramName) {
		this.paramName = paramName;
	}

	@Column(name = "param_value", nullable = false, length = 2000)
    @SearchableProperty
	public String getParamValue() {
		return paramValue;
	}

	public void setParamValue(String paramValue) {
		this.paramValue = paramValue;
	}

	public boolean equals(Object o) {
		if(o != null) {
			if(o instanceof UserTaskParam) {
				UserTaskParam utp = (UserTaskParam) o;
				return utp.getId().equals(getId());
			}
		}
		return false;
	}
	
	public int hashCode() {
		return id.intValue();
	}
	
	public String toString() {
		return getParamName() + " " + getParamValue();
	}
	
}
